package hu.vpszd.services.impl;

import static org.junit.Assert.*;

import java.util.Date;

import hu.vpszd.entities.transaction.Income;
import hu.vpszd.entities.transaction.LoanApplication;

import org.junit.Test;

class MinimumConditionCheckerServiceImplTest {

	private MinimumConditionCheckerServiceImpl mccsi = new MinimumConditionCheckerServiceImpl()

	public LoanApplication createLA(int incomeAmount1, int incomeAmount2) {
		LoanApplication loanApplication = new LoanApplication();
		loanApplication.birthday = new Date(89,8,17,0,0)

		Income income = new Income();
		income.setCompanyAddress("asd utca");
		income.setCompanyName("asd kft");
		income.setId(1L);
		income.setIncomeAmount(incomeAmount1);
		income.setIncomeType("Alkalmazotti");
		income.setRank("Felsövezetö");
		income.setRegistrationNumber("Cégjegyzékszám");
		income.setTaxNumber("Adószám");
		Date lengthOfEmployement = new Date(104,4,1,0,0);
		income.setLengthOfEmployement(lengthOfEmployement);
		loanApplication.getIncomes().add(income);
		
		income = new Income();
		income.setCompanyAddress("asd utca");
		income.setCompanyName("asd kft");
		income.setId(2L);
		income.setIncomeAmount(incomeAmount2);
		income.setIncomeType("Alkalmazotti");
		income.setRank("Felsövezetö");
		income.setRegistrationNumber("Cégjegyzékszám");
		income.setTaxNumber("Adószám");
		lengthOfEmployement = new Date(104,4,1,0,0);
		income.setLengthOfEmployement(lengthOfEmployement);
		loanApplication.getIncomes().add(income);

		return loanApplication
	}
	
	//TODO: az incomeok összegével vmit csinálni, mert így nem jó
	
	@Test
	public void testLowerThan83000_1() {
		LoanApplication la = createLA(82100,0)
		mccsi.checkMinimumCondition(la)
		assert !la.isIncomeAmountEnough && la.isLengthOfEmployementEnough
	}
	
	@Test
	public void testHigherThan83000_1() {
		LoanApplication la = createLA(83100,0)
		mccsi.checkMinimumCondition(la)
		assert la.isIncomeAmountEnough && la.isLengthOfEmployementEnough
	}
	
	@Test
	public void testEquals83000_1(){
		LoanApplication la = createLA(83000,0)
		mccsi.checkMinimumCondition(la)
		assert la.isIncomeAmountEnough && la.isLengthOfEmployementEnough
	}
	
	@Test
	public void testEquals83000_2(){
		LoanApplication la = createLA(70000,13000)
		mccsi.checkMinimumCondition(la)
		assert la.isIncomeAmountEnough && la.isLengthOfEmployementEnough
	}
	
	@Test
	public void testLowerThan83000_2() {
		LoanApplication la = createLA(70000,12100)
		mccsi.checkMinimumCondition(la)
		assert !la.isIncomeAmountEnough && la.isLengthOfEmployementEnough
	}
	
	@Test
	public void testHigherThan83000_2() {
		LoanApplication la = createLA(70000,13100)
		mccsi.checkMinimumCondition(la)
		assert la.isIncomeAmountEnough && la.isLengthOfEmployementEnough
	}
	
	@Test
	public void testHigherThan83000_3(){
		LoanApplication la = createLA(90000,130000)
		mccsi.checkMinimumCondition(la)
		assert la.isIncomeAmountEnough && la.isLengthOfEmployementEnough
	}
	
	
	
	
	
//	@Test
//	public void vmi(){
//		assert 45L as Integer == 45i
//	}
}
